from _signal import pause

from gpiozero import LED
from gpiozero.pins.rpigpio import RPiGPIOFactory
from time import sleep

# local_factory = RPiGPIOFactory()
# led_1 = LED(17, pin_factory=local_factory)  # local pin
# # button = Button("GPIO27")
# # red.on()
# # pause()
# while True:
#     red.on()
#     logger.info("run")
#     sleep(3)
#     red.off()
#     sleep(3)

# holds = [False, False]
# for i in holds:
#     print(i)
#
# for i in range(holds):
#     print(i)
#
# for i, hold in enumerate(holds):
#     if not hold:
#         print(i)


# from Track import Track
#
# # print(Track().get_pos())
# Track().move_to(0)

# a = {"a": 1}
# print("a" in a)
# print(a.has_key("b"))


import threading

from Gripper import Gripper
#
# for i in range(20, 40):
#     print(i, 5.0 * i / 100.0)
#
# for i in range(30, 40):
#     Gripper.claw_ctrl("", i)
#     sleep(0.1)
#
#
Gripper().claw_ctrl(40)
# Gripper.open("")

sleep(2)
Gripper().claw_ctrl(30)
sleep(2)
Gripper().claw_ctrl(40)
sleep(2)
Gripper().claw_ctrl(30)
pause()
# sleep(2)
# Gripper().claw_ctrl(30)
# for i in range(30, 40, -1):
#     print(i)
#
# pos = 30
# pre_pos = 40
#
# rev = 1
# if pos > pre_pos:
#     rev = -1
#
# for i in range(pos, pre_pos + rev, rev):
#     print(i)
